package game.Menus;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Vector2f;

import game.ActionListener;
import game.Config.Config;

/**
 * A text picture item contains both text and a picture.
 * @author Sebastian Isheden and Victor Beer
 *
 */
public class TextPictureItem extends TextMenuItem{

	//These will be printed if the item is selected.
	private String selectedText;
	private Image selectedImage;
	private Vector2f selectedPosition;
	//The offset for where the picture should be printed
	private Vector2f offset;
	/**
	 * Creates a new TextPictureItem.
	 * @param text The text the item will display.
	 * @param selectedText  The text the item wil display when selected.
	 * @param selectedImage The image the item will display when selected.
	 * @param selectedPosition THe position to dipslay the text and image when selected.
	 * @param offset The offset between the seleced text and picture.
	 * @param action The action to perform when the item is called.
	 */
	public TextPictureItem(String text, String selectedText,Image selectedImage, Vector2f selectedPosition,Vector2f offset, ActionListener action) {
		super(text, action);
		this.selectedText = selectedText;
		this.selectedImage = selectedImage;
		this.selectedPosition = selectedPosition;
		this.offset = offset;
		// TODO Auto-generated constructor stub
	}
	/**
	 * Prints the contents of this TextPictureItem.
	 * If the item is selected, it will also display further
	 * information and a picture.
	 */
	@Override
	public void print(Graphics graphic, Vector2f position, boolean selected) {
		super.print(graphic, position, selected);
		if(selected){
			graphic.drawString(selectedText, selectedPosition.x, selectedPosition.y);
			graphic.drawImage(selectedImage, selectedPosition.x+offset.x, selectedPosition.y + offset.y);
		}
	}

}
